package memento;

public class Client {

    public static void main(String[] args) {

        GameRome gameRome1 = new GameRome("张三", 100, 50);
        GameRome gameRome2 = new GameRome("李四", 50, 100);
        Caretaker caretaker = new Caretaker();
        //备份普通状态
        caretaker.setRotesMementos("张三", gameRome1);
        caretaker.setRotesMementos("李四", gameRome2);

        gameRome1.setVit(200);
        gameRome1.setDef(100);
        gameRome2.setVit(100);
        gameRome2.setDef(200);
        //备份狂暴状态
        caretaker.setRotesMementos("张三", gameRome1);
        caretaker.setRotesMementos("李四", gameRome2);

        System.out.println("对战后回复普通状态");
        gameRome1.recoverFromMemento(caretaker.getRotesMementos("张三",0));
        gameRome2.recoverFromMemento(caretaker.getRotesMementos("李四",0));

        System.out.println("再次回复狂暴状态");
        gameRome1.recoverFromMemento(caretaker.getRotesMementos("张三",1));
        gameRome2.recoverFromMemento(caretaker.getRotesMementos("李四",1));

    }

}
